import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader;

import javax.lang.model.type.ArrayType;

public class TestDemo {
    public static  String toostring(int[] arr , int n) {
        String str="[";

        for(int i = 0 ;i < n; i++) {
            str = str+String.valueOf(arr[i]);
            if( i != n - 1)  {
                str += ",";
            }
        }

        str+=']';
        return str;
    }
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        System.out.println(toostring(arr, arr.length));
    }
    public static void copyOf(int[] arr, int n) {
        int[] array = new int[20];
        for(int i = 0;i < n ;i++) {
            array[i] = arr[i];
            System.out.print(array[i] +
    }
    public static void main6(String[] args) {
        int[] arr ={1,2,3,4,5,6,7,8,9,10};
        copyOf(arr,arr.length);
    }
    public static void printArras(int[] arr, int n) {
        for (int i = 1; i <=n; i++) {
            arr[i-1] = i;
        }
    }
    public static void main5(String[] args) {
        int[] arr = new int[100];
        printArras(arr,arr.length);
        for (int x : arr) {
            System.out.print(x+" ");
        }
    }
    public static void printArray(int[] arr ) {
        for (int x : arr) {
            System.out.print(x+" ");
        }
    }
    public static void main4(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        printArray(arr);
    }
    public static void transform(int[] arr ,int n) {
        for (int i = 0; i < n; i++) {
            arr[i] = arr[i]*2;
        }
    }
    public static void main3(String[] args) {
        int[] arr = {1,3,6,9,12,24};
        transform(arr,arr.length);
        for (int x : arr) {
            System.out.print(x+" ");
        }
    }
        public static int Add(int[] arr, int n) {
            int sum = 0;
            for (int x : arr) {
                sum+=x;
            }
            return sum;
        }
        public static void main2(String[] args) {
            int[] arr = {1,2,3,4,5,20,7,8,9,10};
            System.out.println(Add(arr, arr.length));
        }

    public static double avg(int[] arr, int n) {
        int sum = 0;
        for (int x : arr) {
            sum+=x;
        }
        return sum/10;
    }
    public static void main1(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9,10};
        System.out.println(avg(arr, arr.length));
    }
}
